import 'package:flutter/material.dart';

// 定义有状态组件
// 快捷键：fstfull，得安装插件：Flutter Widget Snippets
class HomePage10_1 extends StatefulWidget {
  const HomePage10_1({Key? key}) : super(key: key);

  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage10_1> {
  // 状态变量
  int count = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('ListView组件', style: TextStyle(color: Colors.white)),
        backgroundColor: Colors.blue,
      ),
      // 1. 默认构造函数
      body: ListView(
        // 滚到方向，横向
        // scrollDirection: Axis.horizontal,
        // 纵向
        scrollDirection: Axis.vertical,
        // padding: EdgeInsets.symmetric(horizontal: 20),
        // padding: EdgeInsets.only(left: 20),
        children: [
          Container(
            height: 80,
            color: Colors.blue,
            alignment: Alignment.centerLeft,
            child: Text('鸿蒙大事件1'),
          ),
          Container(
            height: 80,
            color: Colors.blue,
            alignment: Alignment.centerLeft,
            child: Text('鸿蒙大事件2'),
          ),
          Container(
            height: 80,
            color: Colors.blue,
            alignment: Alignment.centerLeft,
            child: Text('鸿蒙大事件3'),
          ),
          Container(
            height: 80,
            color: Colors.blue,
            alignment: Alignment.centerLeft,
            child: Text('鸿蒙大事件4'),
          ),
          Container(
            height: 80,
            color: Colors.blue,
            alignment: Alignment.centerLeft,
            child: Text('鸿蒙大事件5'),
          ),
        ],
      ),
    );
  }
}
